# -*- coding:utf-8 -*-
# created on 2017/4/30
# 

from mathsolver.functions.base import *


# 已知正方形ABCD
class XLSquareUpdate(BaseFunction):
    """
    已知正方形ABCD的边长为2,E为CD的中点,则\\overrightarrow{AE}•\\overrightarrow{BD}=().
    """
    def solver(self, *args):
        quadra_points = args[0].value
        p1, p2, p3, p4 = quadra_points
        square = BaseVectorSquare(p1, p2, p3, p4)
        self.output.append(square)
        return self


# 已知菱形ABCD
class XLDiamondUpdate(BaseFunction):
    """
    已知菱形ABCD的边长为a,\\angle ABC=60°,则\\overrightarrow{BD}•\\overrightarrow{CD}=()
    """
    def solver(self, *args):
        quadra_points = args[0].value
        p1, p2, p3, p4 = quadra_points
        diamond = BaseVectorDiamond(p1, p2, p3, p4)
        self.output.append(diamond)
        return self


# 已知矩形ABCD
class XLRectangleUpdate(BaseFunction):
    """
    已知矩形ABCD,|\\overrightarrow{AB}|=6, |\\overrightarrow{AD}|=4.\\overrightarrow{BM}=3\\overrightarrow{MC},
    \\overrightarrow{DN}=2\\overrightarrow{NC},则\\overrightarrow{AM}•\\overrightarrow{NM}=()
    """
    def solver(self, *args):
        quadra_points = args[0].value
        p1, p2, p3, p4 = quadra_points
        rectangle = BaseVectorRectangle(p1, p2, p3, p4)
        self.output.append(rectangle)
        return self
